﻿using DFGK_WMS.Model.Dto;
using DFGK_WMS.Model.Dto.YS;
using DFGK_WMS.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK.IService
{
    public interface IShippingOrderDetailService
    {
        /// <summary>
        /// 添加出库单
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool AddShippingOrderDetail(ShippingOrderDetail m, out string message);

        /// <summary>
        /// 拣选出库回流
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool StartPickingShippingOrderDetail(StartInventoryDTO m, out string message);

        /// <summary>
        /// 完成拣选入库
        /// </summary>
        /// <param name="putcode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool FinishPickingShippingOrderDetail(string putcode, out string message);

        /// <summary>
        /// 出库单查询
        /// </summary>
        /// <param name="ordersn"></param>
        /// <param name="materialkey"></param>
        /// <param name="status"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<ShippingOrderDetail> GetShippingOrderDetailList(string? ordersn, string? materialkey, int status, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 出库单查询
        /// </summary>
        /// <param name="ordersn"></param>
        /// <param name="materialkey"></param>
        /// <param name="status"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<ShippingOrderDetailLockDto>? GetShippingOrderDetailLockDtoList(string? ordersn, string? materialkey, int status, int pageIndex, int pageSize, out int totalCount);

        bool ModifyPurOrderNo(List<ShippingOrderDetailLockDto> dt);

        /// <summary>
        /// 获取出库物料
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<ShippingSelectMaterialDto> GetInventoryByMaterialAll(int pageIndex, int pageSize, string? mname, string? arecode, string? SuplierName,string? StockName, out int count);

        /// <summary>
        /// 一键选定出库数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="mname"></param>
        /// <param name="outqty"></param>
        /// <param name="arecode"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        List<ShippingSelectMaterialDto>? GetSelectInventoryMaterialAll(int pageIndex, int pageSize, long? mid, decimal? outqty, string? arecode, out int count);

        /// <summary>
        /// 一键选定出库数据无补货逻辑
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="mid"></param>
        /// <param name="outqty"></param>
        /// <param name="arecode"></param>
        /// <param name="batchno"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        List<ShippingSelectMaterialDto>? GetSelectInventoryMaterialAllNo(int pageIndex, int pageSize, long? mid, decimal? outqty, string? arecode, string? batchno, out int count);

        /// <summary>
        /// 删除出库管理
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool DelShippingOrderDetail(long id, out string message);

        /// <summary>
        /// 根据主键获取对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ShippingOrderDetail? GetShippingOrderDetailById(long id);

        /// <summary>
        /// 根据主键获取对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ShippingMaterialLookDto? GetShippingMaterialLookDtoById(long id);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool UpdShippingOrderDetail(ShippingOrderDetail m, out string message);

        /// <summary>
        /// PDA出库选择明细
        /// </summary>
        /// <param name="key"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<ShippingOrderDetailGroupDTO> GetShippingOrderDetailGroup(string key, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 开始出库
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        bool StartShippingOrderDetail(List<SubmitOutListDTO> m, out string message);

        /// <summary>
        /// 出库时排序，优先出浅货位
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        List<SubmitOutListDTO> GetCellDepth(List<SubmitOutListDTO> m);

        /// <summary>
        /// 完成出库
        /// </summary>
        /// <param name="putcode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool FinishShippingOrderDetail(string putcode, out string message);

        /// <summary>
        /// 根据托盘查询组垛信息
        /// </summary>
        /// <param name="PalletCode"></param>
        /// <returns></returns>
        StackingReceivingsDto? GetReceivingRoderData(string PalletCode, out string message);

        /// <summary>
        /// 拣选入库时呼叫库存中的料箱
        /// </summary>
        /// <param name="OrderDTO"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool StartShippingOutZeroQty(List<SubmitOutListDTO> OrderDTO, out string message);

        /// <summary>
        /// 完成拣选出库
        /// </summary>
        /// <param name="putcode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool FinishShippingOutZeroQty(string pickcode, out string message);

        /// <summary>
        /// 打包台数据处理
        /// </summary>
        /// <param name="PalletCode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool UpdShippingLockCellStatus2(string PalletCode, out string message);

        /// <summary>
        /// 暂存区数据处理
        /// </summary>
        /// <param name="PalletCode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool UpdShippingLockCellStatus4(string PalletCode, out string message);

        /// <summary>
        /// 打包台显示
        /// </summary>
        /// <param name="PalletCode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        PackCachePortDto? GetPackCachePort(string PalletCode, out string message);

        /// <summary>
        /// 暂存区显示
        /// </summary>
        /// <param name="PalletCode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        PackCachePortDto? GetPackCachePort2(string PalletCode, out string message);

        /// <summary>
        /// 根据单号获取收货单信息
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        List<ShippingOrderDetail> GetShippingOrderDetailByOrder(string order);

        #region 机械爪
        /// <summary>
        /// 获取空托盘出库到暂存区
        /// </summary>
        /// <returns></returns>
        bool GetEmptyPalletBarcode(out string message);

        /// <summary>
        /// 完成获取空托盘任务
        /// </summary>
        /// <param name="pickcode"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool FinishEmptyPalletBarcode(string pickcode, out string message);

        /// <summary>
        /// Wcs请求出库任务
        /// </summary>
        /// <param name="m"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        List<WcsTaskResultDtos>? WCSOutTask(OutTaskNoticeReqDto m, out string message);
        #endregion

        #region 弃用
        /// <summary>
        /// 打包区显示
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<ShippingOrderDetailGroupDTO> GetShippingLockCellPackList(string? order, int pageIndex, int pageSize, out int totalCount);

        /// <summary>
        /// 暂存区显示
        /// </summary>
        /// <param name="order"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<ShippingOrderDetailCachePortGroupDTO> GetShippingLockCellCachePortList(string? order, int? status, DateTime startdate, DateTime enddate, int pageIndex, int pageSize, out int totalCount);

        bool UpdShippingLockCellStatus2(List<ShippingLockPackDto> ids, out string message);

        bool UpdShippingLockCellStatus4(List<long> ids, out string message);
        #endregion

        /// <summary>
        /// ERP下发出库单
        /// </summary>
        /// <param name="eBSShippingOrder"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool ERPAddShippingOrderDetail(ErpShippingOrderDTO erpShippingOrder, out string message);
        /// <summary>
        /// ERP下发仓库调拨单（成品发货部分）
        /// </summary>
        /// <param name="erpSendOrder"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool ERPAddSendOrderDetail(ErpSendOrderDTO erpSendOrder, out string message);
    }
}
